/* Sokoban
 * HIT3243
 * Authors: Mike Blackney, Ben Ingarfield, Kurniawan
 */

#pragma once

#include "dxf.h"
#include "ai.h"

/* class Pawn
 *
 * Represents a game actor and their sprite.
 * For the 3d version, represents an actor and
 * their 3d model.
 *
 */

// Forward decl.:
class CXFileEntity;
class CXFileInstance;

#define TYPE_PLAYER 0
#define TYPE_CRATE 1
#define TYPE_WALL 2

class Pawn {
public:
	Pawn( int, AiFunction *,
		  LPDIRECT3DDEVICE9, CXFileEntity*, const D3DXVECTOR3&,
		  float, float, float );
	~Pawn( );

	HRESULT Unload( );

	void Update ( double fTime, float fElapsedTime );
	void Render3D( IDirect3DDevice9 *pd3dDevice, double fTime, float fElapsedTime ) const;

	void ResetAi( );
	AiFunction *GetAi( ) const;
	void SetAi( AiFunction* );

	bool operator <( const Pawn & ) const; // For depth-sort

	// World-space coordinates, which are translated into
	// screen coordinates (public for accessibility):
	float x, y, z, rotation;

	// Pawn type:
	int type;

	// The 3d model object (public for same reason):
	mutable CXFileInstance *model;

private:

	// Function pointer for the AI:
	AiFunction *ai;

	// The world translation ratios for the 3d model:
	const D3DXVECTOR3 world;

};
